# -*- coding:utf-8 -*-
'''
@Author: lindes
'''
from django import forms

from post.models import Post


class PostForm(forms.ModelForm):
    title = forms.CharField(label="标题", max_length=20, required=True)
    content = forms.CharField(label="反馈内容", max_length=250, min_length=1, required=True)

    class Meta:
        model = Post
        fields = ('title', 'content')

        error_messages = {
            'title': {
                'max_length': '标题长度不能超过20',
                'required': '标题必填'
            },
            'content': {
                'required': '内容必填'
            }
        }
